//
//  AboutUsViewController.m
//  GolfFriend
//
//  Created by Vescky on 14-3-2.
//  Copyright (c) 2014年 vescky.org. All rights reserved.
//

#import "AboutUsViewController.h"
#import "AboutUsDetailViewController.h"
#import "AppDelegate.h"
#import "WebappBrowserViewController.h"


@interface AboutUsViewController ()<UITableViewDelegate,UITableViewDataSource> {
    NSArray *listArray;
}
@end

@implementation AboutUsViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    [self setTitle:@"关于名媛荟"];
    [super customBackButton];
    listArray = [[NSArray alloc] initWithObjects:cell1/*,cell2*/,cell3/*,cell4*/,cell5, nil];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - UITableViewDelegate
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return [listArray count];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    static NSString *CellIdentifier = @"MoreViewCell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    
    if(!cell){
        cell = [listArray objectAtIndex:indexPath.row];
    }
    
    [cell setTag:indexPath.row];
    
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    [tbList deselectRowAtIndexPath:indexPath animated:YES];
    if (indexPath.row == 0) {
        //关于名媛荟
        WebappBrowserViewController *wb = [[WebappBrowserViewController alloc] init];
        wb.title = @"关于名媛荟";
        [wb setWebappLink:@"http://mingyuanhui.sinaapp.com/test/webveiw/aboutus.html"];
        [self.navigationController pushViewController:wb animated:YES];
    }
/*    else if (indexPath.row == 1) {
        //去评分
    }*/
    else if (indexPath.row == 1) {
        //功能介绍
        WebappBrowserViewController *wb = [[WebappBrowserViewController alloc] init];
        wb.title = @"功能介绍";
        [wb setWebappLink:@"http://mingyuanhui.sinaapp.com/test/webveiw/features.html"];
        [self.navigationController pushViewController:wb animated:YES];
    }
    else if (indexPath.row == 2) {
        //检查新版本
        [APP_DELEGATE checkNewVersion:YES];
    }
    else if (indexPath.row == 4) {
        //帮助与反馈
        //XXXXXXXXXXXXXX
    }
}

- (IBAction)btnAction:(id)sender {
    WebappBrowserViewController *gVc = [[WebappBrowserViewController alloc] init];
    gVc.title = @"用户注册与隐私协议";
    gVc.webappLink = @"http://mingyuanhui.sinaapp.com/test/webveiw/agreement.html";
    [self.navigationController pushViewController:gVc animated:YES];
    [self.navigationController setNavigationBarHidden:NO];
}

@end
